<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
        Object.prototype.toString
        缺点：不能判断自定义对象类型
      */
      console.log(Object.prototype.toString.call(1)); // [object Number]
      console.log(Object.prototype.toString.call("hello")); // [object String]
      console.log(Object.prototype.toString.call(true)); // [object Boolean]
      console.log(Object.prototype.toString.call(function () {})); // [object Function]
      console.log(Object.prototype.toString.call([])); // [object Array]
      console.log(Object.prototype.toString.call(null)); // [object Null]
      console.log(Object.prototype.toString.call(undefined)); // [object Undefined]
      console.log(Object.prototype.toString.call(Symbol())); // [object Symbol]
      console.log(Object.prototype.toString.call({})); // [object Object]

      class Person {}
      const p = new Person(); // Person

      console.log(Object.prototype.toString.call(p)); // [object Object]

      // const arr = []; //  new Array()
      // const obj = {}; // new Object();
      // const num = 100; // new Number();
    </script>
  </body>
</html>
